<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="../css/reg.css" type="text/css"></link>
		<script type="text/javascript"
			src="../js/jquery-validation-1.10.0/lib/jquery-1.7.2.js"></script>
		<script type="text/javascript">  
		function image_check(id){
			
			var strSrc = $("#image_"+id).val();
			alert(strSrc);
			var pos = strSrc.lastIndexOf(".");
	       	var lastname = strSrc.substring(pos, strSrc.length);
	            if (lastname.toLowerCase() != ".jpg"&&lastname.toLowerCase() != ".png"&&lastname.toLowerCase() != ".gif"&&lastname.toLowerCase() != ".bmp") {
	               alert("您上传的文件类型为" + lastname + "，图片必须为 JPG、png、bmp、gif 类型","info");
	                return false;
	            }
	         
		}
		

		</script>
		<link rel="stylesheet" href="../css/Style.css" type="text/css"></link>
	</head>
	<body>
		<table width="980px" border="0" cellspacing="0" cellpadding="0"
			align="center">
			<tr>
				<td width="50%" height=80 rowspan=2>
					<div class=Mleft>

						<img src="../imgs/logo.gif" border=0>
					</div>
				</td>
				<td width="50%">
					<span id=AjaxShow></span>
					<br>
				</td>
			</tr>
			<tr>
				<td valign=bottom align=right>
					欢迎您：
					<strong><font color=red>${user.name }</font> </strong>
					<a href=/login.asp?Action=Logout target=_parent>退出</a>
				</td>
			</tr>
		</table>
		<table id=div border="0" cellspacing="0" cellpadding="0" align=center>
			<tr>
				<td>
					<img src=../imgs/center_top.gif>
				</td>
			</tr>
			<tr>
				<td
					style='padding: 5px; border-left: 1px #CCCCCC solid; border-right: 1px #CCCCCC solid'>
					<table border="0" cellspacing="0" cellpadding="0" align=center>
						<tr>
							<td width="155" valign=top>
								<jsp:include page="../frame/left.jsp" />
							</td>
							<td width="810" valign="top">
								<!-- right -->
								<div class="UserPath">
									您的位置：
									<a href="<%=path%>/changeuser/changeuser!showUserInfo.action">会员中心</a> &gt;
									<a href="<%=path%>/user/changeUserAvatar.jsp">修改头像</a>
								</div>
								<table width="100%" cellpadding="2" cellspacing="1" border="0"
									align="center" class="td1">
									<tbody>
										<tr class="td2">
											<td>
												&nbsp;
												<a href="<%=path%>/user/changeUserInfo.jsp">修改资料</a>|
												<a href="<%=path%>/user/changeUserPassWord.jsp">修改密码</a>|
												<a href="<%=path%>/user/changeUserAvatar.jsp">修改头像</a>
											</td>
										</tr>
									</tbody>
								</table>
								<form method="post"
									action="<%=path%>/changeuser/changeuser!updateUserAvatar.action"
									name="myform" enctype="multipart/form-data">
									<table width="100%" border="0" cellspacing="1" cellpadding="0"
										class="td1" align="center">

										<tbody>
											<input type="hidden" name="user.id" value="${user.id }" />
											<tr>
												<td class="td4" colspan="2">
													修改头像
												</td>
											</tr>
											<tr class="td2">
												<td height="30px" colspan="2"></td>
											</tr>
											<tr class="td2">
												<td width="20%" align="center">
													<div class="Edit_face">
														<c:choose>
															<c:when test="${user.avatar==null}">
																<Img Src='../imgs/Image0.gif' width=100xp height=100px>
															</c:when>
															<c:when test="${user.avatar!=''}">
																<Img Src='../user_avatar_${user.id }/${user.avatar }'
																	width=100xp height=100px>
															</c:when>
														</c:choose>
													</div>
												</td>
												<td width="80%" valign="top">

													从电脑中上传：
													<input type="file" id="image_1" name="image"
														onChange="image_check()" />

													<br>
													<br>
													<input type="submit" value="确定修改">
												</td>
											</tr>

										</tbody>

									</table>
								</form>
								<!-- right end -->
							</td>
						</tr>

					</table>
				</td>
			</tr>
			<tr>
				<td>
					<img src="../imgs/center_bottom.gif">
				</td>
			</tr>
		</table>


	</body>
</html>
